#include <iostream>
#include <cmath>
#include <unordered_map>
#include <string>

bool is_prime(int n) {
    if (n <= 1) return false;
    for (int i = 2; i <= std::sqrt(n); ++i) {
        if (n % i == 0) return false;
    }
    return true;
}

int main() {
    std::unordered_map<std::string, int> word_to_num = {
        {"zero", 0}, {"one", 1}, {"two", 2}, {"three", 3},
        {"four", 4}, {"five", 5}, {"six", 6}, {"seven", 7},
        {"eight", 8}, {"nine", 9}
    };

    int num = 0;
    std::string word;
    while (std::cin >> word) {
        if (word_to_num.find(word) == word_to_num.end()) {
            std::cout << "Wrong input" << std::endl;
            return 0;
        }
        num = num * 10 + word_to_num[word];
    }

    while (!is_prime(num)) ++num;
    std::cout << num << std::endl;

    return 0;
}
